package iot.ht.job;

import iot.core.manager.job.IMyDBJob;
import iot.core.manager.job.IMyJob;
import iot.core.springboot.ApplicationUtils;
import iot.core.util.MyDateTime;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.util.ObjectUtils;


@DisallowConcurrentExecution

@Slf4j
public class PrintJob22   implements IMyDBJob  {
    @Override
    public String getJobName() {
        return "PrintJob22";
    }

    @Override
    public String getJobGroup() {
        return "Group1";
    }

    @Override
    public String getJobDesc() {
        return "测试";
    }

    @Override
    public String getCron() {
        return "*/5 * * * * ?";//5秒
    }


    StringRedisTemplate redisTemplate;
    public   void  run(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try{

            log.info("Begin:"+ this.getJobName()+":"+ MyDateTime.now()+" id:"+Thread.currentThread().getId() );
            Thread.sleep(10000);
            log.info("End:" +this.getJobName()+":"+ MyDateTime.now()+" id:"+Thread.currentThread().getId() );
        }
        catch (Exception ex){

        }
        finally {

        }
    }
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        run(jobExecutionContext);
    }
}
